package com.cedric.yixianpai.game.cards.Sects.swordCards.c_JinDan;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class AnYaLingJian extends SwordCard {
    private int shieldPerSE=0;
    /**
     * title:暗鸦灵剑
     * effect:6攻，每剩余1点灵气加2/3/4防
     */
    public AnYaLingJian(@Value("1") int lvl) {
        super("暗鸦灵剑");
        this.setLevel(lvl);
        this.setPeriod(Period.JINDAN);
        this.setDescription("6攻，每剩余1点灵气加2/3/4防");

        this.setDamage(6);
        if (1 == lvl) {
            this.shieldPerSE=2;
        } else if (2 == lvl) {
            this.shieldPerSE=3;
        } else if (3 == lvl) {
            this.shieldPerSE=4;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.attack(Sta2,this.getDamage());
        Sta1.getPlayerBuff().clearSwordIntent();
        int add=this.shieldPerSE*Sta1.getPlayerBuff().getSpiritualEnergy();
        Sta1.getPlayerBuff().addShield(add);
        return true;
    }
}
